/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package towerdefense.data;

import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;

/**
 *
 * @author Markus Paller
 */
public class Tower {

    private int range;
    private int damage;
    private int cost;
    private String name;
    private int reloadTime;
    private BufferedImage towerimg;

    public Tower(int range, int damage, int cost, int speed, String name) throws Exception {
        if (name.isEmpty()) {
            throw new Exception("Towername must not be empty!");
        }
        if (range < 0) {
            throw new Exception("range must be 0 or higher!");
        }
        if (damage < 0) {
            throw new Exception("power must be 0 or higher!");
        }
        if (cost < 1) {
            throw new Exception("cost must be 1 or higher!");
        }

        switch (name) {
            case "SauronsEye":
                towerimg = ImageIO.read(new File("img/Tower_SauronsEye.png"));
                break;
            case "SentryGun":
                towerimg = ImageIO.read(new File("img/Tower_SentryGun.png"));
                break;
        }

        this.range = range;
        this.damage = damage;
        this.cost = cost;
        this.name = name;
        this.reloadTime = reloadTime;
    }

    public int getRange() {
        return range;
    }

    public int getDamage() {
        return damage;
    }

    public int getCost() {
        return cost;
    }

    public String getName() {
        return name;
    }

    public int getReloadTime() {
        return reloadTime;
    }
}
